package one.stand.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import one.stand.aop.ApiController;
import one.stand.model.ResultModel;
import one.stand.request.FollowRecordRequest;
import one.stand.request.TokenRequest;
import one.stand.response.FollowRecordResponse;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Administrator
 */
@RestController
@RequestMapping("crmApi/followRecord")
@Api(description = "跟进业务")
public class FollowRecordController extends BaseController {

    @ApiOperation(value = "添加跟进记录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "cardId", value = "跟进用户名片id", required = true, paramType = "Integer"),
            @ApiImplicitParam(name = "followType", value = "跟进方式 1电话拜访 ,2微信拜访,3手动添加,4当面拜访,5其它", required = true, paramType = "Integer"),
            @ApiImplicitParam(name = "followRemark", value = "跟进备注", required = false, paramType = "Integer"),
    })
    @PostMapping("addFollow")
    @ApiController(isLogin = true,company=true,card = true,paramClass =FollowRecordRequest.class )
    public ResultModel<Boolean> addFollow(@RequestAttribute FollowRecordRequest request) {
        
        return crmFegin.addFollow(request);
    }

    @ApiOperation(value = "获取跟进记录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "cardId", value = "跟进用户名片id", paramType = "Integer"),
            @ApiImplicitParam(name = "pageSize", value = "每页条数", required = true, paramType = "Integer"),
            @ApiImplicitParam(name = "pageNum", value = "当前页", required = true, paramType = "Integer"),
    })
    @PostMapping("getFollowList")
    @ApiController(isLogin = true,company=true,card = true,paramClass =FollowRecordRequest.class)
    public ResultModel<List<FollowRecordResponse>> getFollowList(@RequestAttribute FollowRecordRequest request) {
        
        return crmFegin.getFollowList(request);
    }

}
